class LanguageTagLib {


    def btnLanguage = { attrs ->
        def currentLanguage = attrs.get('language')
        def currentView = attrs.get('currentView')
        def currentController = attrs.get('currentController')
        def param = attrs.get('param')
        def idProject = attrs.get('idProject')
        String str=""

             //  str += "<div class=\"language\">"
             //  str +="<p style=\"margins:0px;\">${Inter.printOut('Language',session.language)}:</p>"

            str+="<form action=\"/MegaSoft/language/changeLanguage\" method=\"post\" >"

            if(currentLanguage ==null ||currentLanguage=="sv"){ // if in sandbox mode, allow button budget mod
                str += "<span class=\"menuButtons\">"
                str += "<input type=\"hidden\" id=\"currentView\" name=\"currentView\" value=\""+currentView+"\"/>"
                str += "<input type=\"hidden\" id=\"currentController\" name=\"currentController\" value=\""+currentController+"\"/>"
                str += "<input type=\"hidden\" id=\"idProject\" name=\"idProject\" value=\""+idProject+"\"/>"
                str += "<input type=\"hidden\" id=\"param\" name=\"param\" value=\""+param+"\"/>"
                str +=  "<img src=\"${resource(dir:'images/skin',file:'gb.png')}\" style=\"border:0;margin-right:4px;\" alt=\"GB flag\" />"
                str += "<input type=\"submit\" class=\"change_mode\"  value=\"English\" name=\"changeLanguage\"/>"
                str+= "</span>"
            }
            else{ // else if in budget mode, allow sandbox button
                str += "<span class=\"menuButtons\">"
                str += "<input type=\"hidden\" id=\"currentView\" name=\"currentView\" value=\""+currentView+"\"/>"
                str += "<input type=\"hidden\" id=\"currentController\" name=\"currentController\" value=\""+currentController+"\"/>"
                str += "<input type=\"hidden\" id=\"idProject\" name=\"idProject\" value=\""+idProject+"\"/>"
                str += "<input type=\"hidden\" id=\"param\" name=\"param\" value=\""+param+"\"/>"
                str += "<img src=\"${resource(dir:'images/skin',file:'se.png')}\" style=\"border:0; margin-right:4px;\" alt=\"SE flag\" />"
                str += "<input type=\"submit\" class=\"change_mode\"  value=\"Swedish\" name=\"changeLanguage\"/>"
                str+= "</span>"
                
            }
            str += "</form>"
        //str += "</div>"
        out << str
    }
}

